#include "limbo/result.h"
#include <cassert>

using namespace limbo;

Result Result::make_error(uint32_t error_code, void *state, Chunk consumed) {
  assert(error_code);
  return Result(error_code, state, consumed, 0);
}

Result Result::make_consumed(void *state, Chunk consumed) {
  return Result(0, state, consumed, 0);
}

Result Result::make_demand(void *state, uint32_t need_bytes) {
  return Result(0, state, {}, need_bytes);
}

Result::Result(uint32_t error_code, void *state, const Chunk &consumed,
               uint32_t need_bytes)
    : error_code_{error_code}, state_{state}, consumed_{consumed},
      need_bytes_{need_bytes} {}
